<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <%@include file="/jsp/common/js.jsp" %>
    <script>
        function changeLevel(i) {
            var name = $('#div' + i).attr('tag');
            var level = $('#level').val();
            if (level == '') {
                alert("请选择日志级别")
                return;
            }
            var url = 'changeLevel?name=' + name + '&level=' + level;
            window.location = url;
            return false;
        }
    </script>
</head>
<body>
<div class="container">
    <h1>控制日志</h1>
    <select id="level" class="form-control" style="width: 200px">
        <option value="">==选择日志级别==</option>
        <option value="ERROR">ERROR</option>
        <option value="WARN">WARN</option>
        <option value="INFO">INFO</option>
        <option value="DEBUG">DEBUG</option>
    </select>
    <hr>
    <%
        List<Map> list = (List) request.getAttribute("list");
        for (int i = 0; i < list.size(); i++) {
            Map logger = list.get(i);
    %>
    <div id="div<%=i %>" tag="<%=logger.get("name")%>"><%=logger.get("name")%>  [<%=logger.get("level")%>]
        <a href="#" onclick="changeLevel(<%=i%>)">修改日志</a>
    </div>
    <%}%>
    <hr>
    <%=request.getAttribute("birth") %>&nbsp;&nbsp;&nbsp;&nbsp;
</div>
</body>
</html>
